home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / 4_0 / DONALDXC / COPYFILE.C < prev    next >
Text File  |  1990-05-01  |  2KB  |  70 lines

  1. /********************************/
  2. /* File: FileCopy.c                */
  3. /*                                */
  4. /* ----------------------------    */
  5. /*                                */
  6. /* IN:                            */
  7. /*    params[0]    = name of input    */
  8. /*    params[1]    = wdid of input    */
  9. /*    params[2]     = name of output*/
  10. /*    params[3]     = wdid of output*/
  11. /********************************/
  12.  
  13. #include    <MacTypes.h>
  14. #include    <OSUtil.h>
  15. #include    <MemoryMgr.h>
  16. #include    <FileMgr.h>
  17. #include    <ResourceMgr.h>
  18. #include    <pascal.h>
  19. #include    <string.h>
  20.  
  21. #define        UsingHypercard
  22.  
  23. #include      <HyperXCMD.h>
  24. #include    <HyperUtils.h>
  25.  
  26. pascal void main( paramPtr )
  27.     XCmdBlockPtr    paramPtr;
  28. /*****************************
  29. *    params[0]    = name of input    
  30. *    params[1]    = wdid of input    
  31. *    params[2]     = name of output
  32. *    params[3]     = wdid of output
  33. *
  34. *****************************/
  35. {
  36.     OSErr        err;
  37.     short        inWD;
  38.     short        outWD;
  39.     long        temp;
  40.     Str31        errCode;
  41.     char        inFile[256];
  42.     char        outFile[256];
  43.  
  44.     paramPtr->returnValue = 0L;
  45.     
  46.     /*** (1) Get our input parameters                 ***/
  47.     HLock( paramPtr->params[0] );
  48.     ZeroToPas( paramPtr, (char *)*(paramPtr->params[0]), (char *)&inFile );
  49.     HUnlock( paramPtr->params[0] );
  50.     
  51.     inWD = (short)paramtoNum( paramPtr, 1 );
  52.  
  53.     HLock( paramPtr->params[2] );
  54.     ZeroToPas( paramPtr, (char *)*(paramPtr->params[2]), (char *)&outFile );
  55.     HUnlock( paramPtr->params[2] );
  56.     
  57.     outWD = (short)paramtoNum( paramPtr, 3 );
  58.     
  59.     temp = (long)CopyFile( inFile, inWD, outFile, outWD );
  60.  
  61.  
  62.     /*** Flush the output volume                ***/
  63.     err = FlushVol( 0L, 0 );
  64.     
  65.     NumToStr( paramPtr, temp, (char *)&errCode );
  66.     paramPtr->returnValue = PasToZero( paramPtr, (char *)&errCode );
  67. }
  68.  
  69.  
  70.